import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "@/assets/scss/global.scss";
import "@/assets/iconfonts/iconfont.css";
import axios from "axios";
import qs from "qs";

// import NProgress from "nprogress";
Vue.prototype.$qs = qs;
Vue.use(ElementUI);
Vue.config.productionTip = false;

// 配置Axios
// axios.defaults.baseURL = "http://39.101.193.115:8081/AnalysisRSSI/v1";
axios.defaults.baseURL = "http://localhost:8081/AnalysisRSSI/v1";

// 请求头拦截
// axios.interceptors.request.use(config => {
//   NProgress.start();
//   config.headers.Authorization = window.sessionStorage.getItem("token");
//   return config;
// });

// axios.interceptors.response.use(config => {
//   NProgress.done();
//   return config;
// });
Vue.prototype.$http = axios;

// 配置组件
// Vue.component('tree-table', TreeTable)
// Vue.use(VueQuillEditor)

// 配置过滤器
Vue.filter("dateFormat", originVal => {
  const dt = new Date(originVal);
  const y = dt.getFullYear();
  const m = (dt.getMonth() + 1 + "").padStart(2, "0");
  const d = (dt.getDate() + 1 + "").padStart(2, "0");
  const hh = (dt.getHours() + 1 + "").padStart(2, "0");
  const mm = (dt.getMinutes() + 1 + "").padStart(2, "0");
  const ss = (dt.getSeconds() + 1 + "").padStart(2, "0");
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
});

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
